{extend name="base" /}
{block name="body"}

<div class="am-padding am-padding-bottom-0">
	<strong class="am-text-primary am-text-lg">{$group_list[$item_info.system_group_id]}</strong> / <small>编辑字段</small>
</div>

<div class="am-padding am-btn-toolbar">
	<div class="am-btn-group am-btn-group-xs">
		<a href="{:url('admin/system/field',['group_id'=>$item_info.system_group_id])}" class="am-btn am-btn-default"><span class="am-icon-list"></span> 列表</a>
		<a href="{:url('admin/system/group')}" class="am-btn am-btn-default"><span class="am-icon-reply"></span> 返回</a>
	</div>
</div>


<form class="am-form"  action="{:url('admin/system/fieldEdit')}" method="post">
	<input type="hidden" name="id" value="{$item_info.id}">
	<input type="hidden" name="system_group_id" value="{$item_info.system_group_id}">
	<fieldset>
		<div class="am-form-group">
			<div class="am-input-group">
				<span class="am-input-group-label">字段</span>
				<input type="text" name="field" class="am-form-field" value="{$item_info.field}" placeholder="请输入字段名">
			</div>
		</div>
		<div class="am-form-group">
			<div class="am-input-group">
				<span class="am-input-group-label">别名</span>
				<input type="text" name="name" class="am-form-field" value="{$item_info.name}" placeholder="请输入别名">
			</div>
		</div>
		<div class="am-form-group">
			<div class="am-input-group">
				<span class="am-input-group-label">提示信息</span>
				<input type="text" name="tips" class="am-form-field" value="{$item_info.tips}" placeholder="提示信息">
			</div>
		</div>

		<div class="am-form-group">
			<div class="am-input-group">
				<span class="am-input-group-label">字段类型</span>
				<select name="type" class="am-form-field" id="field-type">
					{foreach name="fild_type" item="vo"}
					<option value="{$key}" {eq name="$key" value="$item_info.type"}selected{/eq}>{$vo}</option>
					{/foreach}
				</select>
			</div>
		</div>


		<div class="am-form-group" id="setup-options" {in name="$item_info.type" value="select,radio,checkbox"} {else/}style="display:none"{/in}>
			<div class="am-input-group">
				<span class="am-input-group-label">选项列表</span>
				<textarea name="setup[options]" rows="4" placeholder="选项名称|值&#13;&#10;例：&#13;&#10;苹果|apple&#13;&#10;香蕉|banana">{$item_info.setup['options']}</textarea>
				<span class="am-input-group-label am-text-sm">一行一个</span>
			</div>
		</div>

		<div class="am-form-group" id="setup-allowext" {in name="$item_info.type" value="image,file"} {else/}style="display:none"{/in}>
			<div class="am-input-group">
				<span class="am-input-group-label">允许上传的类型</span>
				<input type="text" name="setup[allowext]" class="am-form-field" value="{$item_info.setup['allowext']}" placeholder="允许上传的类型">
				<span class="am-input-group-label am-text-sm">图片：jpg|jpeg|gif|png 压缩包：zip|rar 文件：doc|docx|xls|xlsx|ppt|pptx|txt</span>
			</div>
		</div>


		<div class="am-form-group">
			<div class="am-input-group">
				<span class="am-input-group-label">必填</span>
				<div class="am-form-field">
					<label class="am-radio-inline">
						<input type="radio" name="required" value="1" data-am-ucheck {eq name="$item_info.required" value="1"}checked{/eq}> 是
					</label>
					<label class="am-radio-inline">
						<input type="radio" name="required" value="0" data-am-ucheck {eq name="$item_info.required" value="0"}checked{/eq}> 否
					</label>
				</div>
			</div>
		</div>

		<div class="am-form-group">
			<div class="am-input-group">
				<span class="am-input-group-label">排序</span>
				<input type="number" name="sort" class="am-form-field" value="{$item_info.sort}">
			</div>
		</div>
		<div class="am-form-group">
			<div class="am-input-group">
				<span class="am-input-group-label">状态</span>
				<div class="am-form-field">
					<label class="am-radio-inline">
						<input type="radio" name="status" value="1" data-am-ucheck {eq name="$item_info.status" value="1"}checked{/eq}> 正常
					</label>
					<label class="am-radio-inline">
						<input type="radio" name="status" value="0" data-am-ucheck {eq name="$item_info.status" value="0"}checked{/eq}> 禁用
					</label>
				</div>
			</div>
		</div>
		<p><button type="reset" class="am-btn am-btn-default">重置</button> <button type="submit" lay-submit lay-filter="submit" class="am-btn am-btn-default">保存</button></p>
			
	</fieldset>
</form>
         

{/block}

{block name="script"}
<script>
    $(document).ready(function(){

        $("#field-type").change(function () {
            var type = $(this).val();
            
			if(type == 'select' || type == 'radio' || type == 'checkbox'){
				$("#setup-options").show();
			}else{
				$("#setup-options").hide();
			}

			if(type == 'image' || type == 'file'){
				$("#setup-allowext").show();
			}else{				
				$("#setup-allowext").hide();
			}

        });

	})
</script>
{/block}